import { TOGGLE } from '../action/systemAction'
import { createReducer } from './createReducer'
export const initSystemStore = {
    collapsed: false,//控制侧边栏是否关闭
    loginState: false
}
const reducer = {
    [TOGGLE]: (state, action) => (Object.assign({}, state, {
        ...action
    }))


}
// export const systemReducer = (state = initSystemStore, action = {}) => action.type && reducer[action.type](state, action)
export const systemReducer = (state = initSystemStore, action = {}) => {
    // const res = createReducer(state, reducer)(state, action)
    // console.log('res0000====>', res)
    // return action.type ? reducer[action.type](state, action) : state
    switch (action.type) {
        case TOGGLE:
            return Object.assign({}, state, {
                ...action
            })
        default:
            return state
    }

    // return state
}